package com.itetchologyandenglish.home.service.Impl;

import com.itetchologyandenglish.home.enetity.Auth;
import com.itetchologyandenglish.home.enetity.Roles;
import com.itetchologyandenglish.home.mapper.RoleMapper;
import com.itetchologyandenglish.home.service.RoleService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
@Service
public class RoleServiceImpl implements RoleService {
    @Resource
    RoleMapper roleMapper;
    @Override
    public List<Roles> getRoleList() {
        return roleMapper.getRoleList();
    }

    @Override
    public Roles getRolesIdByRoleName(String roleName) {
        return roleMapper.getRolesIdByRoleName(roleName);
    }

    @Override
    public List<Auth> getUserRoleAuth(Integer roleId) {
        return roleMapper.getUserRoleAuth(roleId);
    }

    @Override
    public boolean addRole(Integer roleId, String roleName) {
        return roleMapper.addRole(roleId,roleName)>0?true:false;
    }

    @Override
    public boolean deleteRole(Integer roleId) {
        return roleMapper.deleteRole(roleId)>0?true:false;
    }
}
